# +----------------------------------------------------------------------
# | Pink [ A modern python web framework ]
# +----------------------------------------------------------------------
# | Copyright (c) 2023 http:#unnnnn.com All rights reserved.
# +----------------------------------------------------------------------
# | Author: chenjianhua <unnnnn@foxmail.com>
# +----------------------------------------------------------------------
import json

from src.pink.controllers import Controller
import json
from faker import Faker


class MockController(Controller):

    def show(self):
        return "welcome"

    def gen_one(self):
        fk = Faker(['zh-CN']) #中文
        # 生成mock数据
        name =  fk.unique.name() # 随机获取姓名
        address =  fk.unique.address() # 随机地址
        #car_no =  fk.automotive() # 随机车牌号
        company =  fk.unique.company() # 随机公司名称
        date_time =  fk.unique.date_time() #  随机日期时间
        email =  fk.unique.ascii_email() # 随机邮箱
        job =  fk.unique.job() # 随机工作
        phone_number =  fk.unique.phone_number() # 随机手机号
        id_card =  fk.unique.ssn() # 随机身份证号

        result = {
            'code': 200,
            'msg': 'success',
            'data': {
                'name': name,
                'address': address,
                #'car_no': car_no,
                'company': company,
                #'date_time': date_time,
                'email': email,
                'job': job,
                'phone_number': phone_number,
                'id_card': id_card
            }
        }

        return json.dumps(result, ensure_ascii=False)
